<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<script src="jquery-1.8.0.min.js"></script>
</head>
<body>
<div  id="password-input">
<input type="text" value="密码" />
</div>
<script> 
var passwordInput= $('#password-input');
var passwordMsg   = '密码';
var inputText     = passwordInput.html();
var inputPassword = inputText.replace('type="text"', 'type="password"').replace('value="'+ passwordMsg +'"', '');

function blurFun(){
    if($.trim($(this).val()) == ''){
        $(this).remove();
        var input = $(inputText).appendTo(passwordInput);
        input.blur();
        input.bind('focus', focusFun);
    }
}
function focusFun(){
    if($(this).val() == passwordMsg){
        $(this).remove();
        var input = $(inputPassword).appendTo(passwordInput);
        input.focus();
        input.bind('blur', blurFun);
    }
}

passwordInput.find('input').bind('focus', focusFun);

console.dir(document);
        var url  = document.URL;
        var doamin  = document.domain;
        var http  = url.indexOf('https://') !== false ? 'https://' : 'http://';
        var url = url.substr( (http + doamin).length - 1);
        console.log(http);
        console.log(url);

</script>

</body>

</html>